function createyeargridform(option) {
    option.form.id = option.form.id || "";
    option.form.saveUrl = option.form.saveUrl || "";
    option.form.items = option.form.items || [];
    option.loadData.preName = option.loadData.preName || "";
    option.loadData.getUrl = option.loadData.getUrl || "";
    option.operation = option.operation || {};
    option.operation.inputFormName = option.operation.inputFormName || "";

    yearGridFormPanel = new Ext.FormPanel({
        id : option.form.id,
        url : option.form.saveUrl,
        layout : "form",
        fileUpload:option.form.fileUpload==null?false:option.form.fileUpload,
        defaults : {
        //labelWidth : 130
        },
        autoScroll : true,
        items : option.form.items
    });
    //当id不等于空时（进行编辑、查看时）显示选中的对应数据
    if (option.operation.id != null && option.operation.id != undefined) {
        yearGridFormPanel.loadData({
            url : option.loadData.getUrl + "?id=" + option.operation.id,
            preName : option.loadData.preName,
            root : "result",
            success : function(response,options) {
                var obj = Ext.decode(response.responseText).result;
                //add by gt 双击是查看，所有组件应为readonly              
                if(option.isShow){ 
                    var form = yearGridFormPanel.getForm();
                    Ext.each(form.items.items,function(f){
                        f.setReadOnly(true);
                    })
                }
                if(option.loadData.callback){
                    option.loadData.callback(obj, yearGridFormPanel);
                }
            }
        });
    };

    this.save = function(a) {
        if (yearGridFormPanel.getForm().isValid()) {
            yearGridFormPanel.getForm().submit({
                method : "post",
                scope:this,
                waitMsg : "正在提交数据...",
                success : function(e, f) {
                    Ext.ux.Toast.msg("操作提示", "信息保存成功！");
                    //定義你要索引的 parent 的條件式，若回傳為 true 將會回傳該 container parent
                    yearGridFormPanel.findParentBy(function(p) {
                        return p.dd.win;
                    }).close();
                    //当保存完数据对页面进行刷新
                    if("undefined"!= typeof option.operation.callback){
                        option.operation.callback(true); 
                    }
                    if("undefined"!= typeof option.operation.addYearGridPanel){
                        Ext.getCmp(option.operation.addYearGridPanel).getStore().reload();
                    }
                    
                },
                failure : function(e, f) {
                    console.info(e)
                    console.info(f)
                    Ext.MessageBox.show({
                        title : "操作提示",
                        msg : f.result.msg=null?"信息保存出错，请联系管理员！":f.result.msg,
                        buttons : Ext.MessageBox.OK,
                        icon : "ext-mb-error"
                    });
                    //定義你要索引的 parent 的條件式，若回傳為 true 將會回傳該 container parent
                    yearGridFormPanel.findParentBy(function(p) {
                        return p.dd.win;
                    }).close();
                }
            });
        }
    }
    

    if (option.operation.operation == Constant.Operation.VIEW) {
        yearGridFormButtons = [ {
            text : "关闭",
            iconCls : "btn-cancel",
            scope : this,
            handler : function() {
                yearGridFormPanel.findParentBy(function(p) {
                    //定義你要索引的 parent 的條件式，若回傳為 true 將會回傳該 container parent
                    return p.dd.win;
                }).close();
            }
        } ];
    } else if (option.operation.operation == Constant.Operation.ADD || option.operation.operation == Constant.Operation.EDIT) {
        yearGridFormButtons = [ {
            text : "保存",
            iconCls : "btn-save",
            scope : this,
            handler : this.save.createCallback(this)
        }, {
            text : "取消",
            iconCls : "btn-cancel",
            scope : this,
            handler : function() {
                yearGridFormPanel.findParentBy(function(p) {
                    //定義你要索引的 parent 的條件式，若回傳為 true 將會回傳該 container parent
                    return p.dd.win;
                }).close();
            }
        } ];
    }

}